package com.ruoyi.project.chargesystem.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.chargesystem.domain.CharCharge;
import com.ruoyi.project.chargesystem.service.ICharChargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/chargesystem/chargequery")
public class CharChargeController extends BaseController {
    @Autowired
    private ICharChargeService iCharChargeService;

    @PreAuthorize("@ss.hasPermi('chargesystem:chargequery:list')")
    @GetMapping("/list")
    public TableDataInfo list(CharCharge charCharge)
    {
        startPage();
        List<CharCharge> list = iCharChargeService.selectAllCharChargeInfo(charCharge);
        return getDataTable(list);
    }

    @PreAuthorize("@ss.hasPermi('chargesystem:chargequery:detailquery')")
    @GetMapping(value = "/{orderId}")
    public TableDataInfo getInfo(@PathVariable("orderId") String orderId)
    {
        List<CharCharge> list = iCharChargeService.selectCharChargeDetailInfo(orderId);
        return getDataTable(list);
    }
}
